<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <style>
        .red{
            color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        {{n}} 
        <input type="button" v-bind:class="{red: n > 0}"value="确定">
        <!-- <img :src="{imgsrc: n > 0}" alt="">  -->
        <!-- <input type="text" v-model=n> -->
        <button @click="n++">添加</button>
    </div>
    <script>
            
        var app = new Vue({
            el: "#app", 
            data: {
                imgsrc:"./img/car.png", 
                //购物车的数量
                n:0,
            }
        });
    </script>
</body>
</html>